<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>项目详情</title>
    <link href="../css/pro-detail.css" type="text/css" rel="stylesheet"/>
    <link href="../css/foundation-datepicker.css" rel="stylesheet"/>
    <link href="../css/client-card.css" rel="stylesheet"/>
    <script type="text/javascript" src="../js/vue.min.js"></script>
</head>
<body>
<!--header-->
<header id="header" class="header">
    <div class="header-info left"><i></i><a href="mems-pro-list.html">项目列表</a> > 项目详情</div>
    <div class="right-user right">
         <div class="clear t" >             <div id="headusername" class="role"></div>             <div class="icon"></div>         </div>
        <div class="head-down">
            <ul><li><a href="edit-pwd.html">修改密码</a></li><li><a onclick="loginOut()">退出系统</a></li></ul></div><div>
        </div>
    </div>
</header>
<!--menu-->
<aside id="aside" class="aside">
    <div class="logo">运营平台</div>
    <ul class="menu" id="asidemenu">
    </ul>
</aside>

<!--content-->
<div class="content" style="background: #FFF;">
    <div class="p-content clear">
        <div class="left content-left">
            <div class="p-header clear">
                <div class="left names"><span id="getHeadProName" onclick="getHeadProName()"></span>&nbsp;&nbsp;<span id="bussProNameTile" style="display: none"></span></div>
                <div class="right opers">
                    <!-- <a href="" class="activity right"></a> -->
                    <a href="javascript:;" class="person right" title="添加用户" onclick="addUserShow()"></a>
                </div>
            </div>
            <ul class="nav clear">
                <li onclick="detailItemTab(this,'clientInfo')" class="current">客户资料</li>
                <li onclick="detailItemTab(this,'accountInfo')">开户资料</li>
                <li onclick="detailItemTab(this,'clientInfoCard')">客户信息卡</li>
                <li onclick="detailItemTab(this,'proNeedList')">项目需求</li>
                <li onclick="detailItemTab(this,'unfinished')">项目合同(暂不做)</li>
                <li onclick="detailItemTab(this,'unfinished')">文档资料(暂不做)</li>
            </ul>

            <!-- 客户资料 -->
            <div class="info-module clear rel" id="clientInfo"  style="display: block;">
                <div class="left module-left">

                    <!-- 兴趣点 -->
                    <div class="dot-module">
                        <div class="dot-head"><i class="dot-1"></i>兴趣点</div>
                         <textarea placeholder="点击添加描述……" id="tag-dec-1"></textarea>
                         <ul class="clear tag-list" id="tag-list-1">
                         </ul>
                         <div style="position: relative;">
                             <div class="add-tag" id="addtag-1">+标签</div>
                             <div class="add-tag-exist-con" id="addtag-input-1">
                                <a href="javascript:" class="close" id="close-exist-tag">关闭</a>
                                <ul class="tag-out-list" id="addtag-input-ul-1">
                                </ul>
                            </div>
                         </div>
                    </div>

                    <!-- 管理方式 -->
                    <div class="dot-module">
                        <div class="dot-head"><i class="dot-2"></i>管理方式</div>
                         <textarea placeholder="点击添加描述……" id="tag-dec-2"></textarea>
                         <ul class="clear tag-list" id="tag-list-2">
                         </ul>
                        <div style="position: relative;">
                             <div class="add-tag" id="addtag-2">+标签</div>
                             <div class="add-tag-exist-con" id="addtag-input-2">
                                <a href="javascript:" class="close" id="close-exist-tag-2">关闭</a>
                                <ul class="tag-out-list" id="addtag-input-ul-2">
                                </ul>
                             </div>
                         </div>

                         <!--<div class="add-tag-con" id="addtag-input-2">-->
                             <!--<input type="text" placeholder="标签名" /><input type="button" value="确认"><input type="button" value="取消">-->
                         <!--</div>-->
                    </div>

                    <!-- 主要竞争对手 -->
                    <div class="dot-module">
                        <div class="dot-head"><i class="dot-3"></i>目前正在使用的设备管理系统</div>
                        <textarea placeholder="点击添加描述……" id="tag-dec-3"></textarea>
                         <ul class="clear tag-list" id="tag-list-3">
                         </ul>
                        <div style="position: relative;">
                             <div class="add-tag" id="addtag-3">+标签</div>
                            <div class="add-tag-exist-con" id="addtag-input-3">
                                <a href="javascript:" class="close" id="close-exist-tag-3">关闭</a>
                                <ul class="tag-out-list" id="addtag-input-ul-3">
                                </ul>
                            </div>
                        </div>
                         <!--<div class="add-tag-con"  id="addtag-input-3">-->
                             <!--<input type="text" placeholder="标签名" /><input type="button" value="确认"><input type="button" value="取消">-->
                         <!--</div>-->
                    </div>

                    <!-- 风险和挑战 -->
                    <div class="dot-module">
                        <div class="dot-head"><i class="dot-4"></i>风险和挑战</div>
                         <textarea placeholder="点击添加描述……" id="tag-dec-4"></textarea>
                         <ul class="clear tag-list" id="tag-list-4">
                         </ul>
                         <!-- <div class="add-tag" id="addtag-4">+标签</div>
                         <div class="add-tag-con" id="addtag-input-4">
                             <input type="text" placeholder="标签名" /><input type="button" value="确认"><input type="button" value="取消">
                         </div> -->
                    </div>
                </div>
                <div class="right module-right">

                    <div class="module-table module-sell">
                        <div class="t-head ">
                            销售方式及预算
                            <a class="edit" id="editeSaleType"></a>
                        </div>
                        <div class="c-body">
                        
                            <table class="show-list">
                                <tbody id="sellBuget">
                                   
                                </tbody>
                            </table>
                            <table class="edite-show-list" style="display: none;">
                                <tr>
                                    <td width="40%">销售方式</td>
                                    <td><select id="sellTypeSelect"></select></td>
                                </tr>
                                <tr>
                                    <td>联系人</td>
                                    <td><input  id="contacts"></td>
                                </tr>
                                <tr>
                                    <td>联系电话</td>
                                    <td><input id="tel"></td>
                                </tr>
                                <tr>
                                    <td>预算(万元)</td>
                                    <td><input id="budget" placeholder="支持一位小数: 1.0"></td>
                                </tr>
                                <tr>
                                    <td><span style="color: red;padding: 0 3px 0 0;">*</span>预计试用时间</td>
                                    <td><input id="proTime" ／></td>
                                </tr>
                                <tr>
                                    <td>预计收款时间</td>
                                    <td><input id="getMoneyTime" ／></td>
                                </tr>
                                <tr>
                                    <td>描述</td>
                                    <td><textarea id="discribe"></textarea></td>
                                </tr>
                                <tr>
                                    <td colspan="2" style="text-align: center;height: 55px;">
                                        <a class="btn" id="cancleEditSell">取消</a>&emsp;<a id="sureEditSell" class="btn">确认</a>
                                    </td>
                                </tr>
                            </table>
                           
                        </div>
                    </div>

                    <div class="module-table module-person">
                        <div class="t-head clear">
                            <p class="left">客户通讯录</p>
                        </div>
                        <div class="c-body">
                            <ul class="base" id="clientAddressBook">
                                
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <!--开户资料-->
            <div class="accountInfo info-module clear rel" id="accountInfo" style="display: none;">
                <table class="accountTable">
                    <thead>
                        <tr>
                            <td align="right" style="font-size: 15px;font-family: 'Microsoft YaHei'">开户申请</td>
                        </tr>
                    </thead>
                    <tbody class="account-check-body" id="account-check-body">
                        <tr>
                            <td>外修：</td>
                            <td><input type="checkbox" value="外修" disabled/></td>
                            <td>直接外修：</td>
                            <td><input type="checkbox" value="直接外修" disabled/></td>
                        </tr>
                        <tr>
                            <td>文档管理：</td>
                            <td><input type="checkbox" value="文档管理" disabled/></td>
                            <td>工单验收：</td>
                            <td><input type="checkbox" value="工单验收" disabled/></td>
                        </tr>
                        <tr>
                            <td>日常检查：</td>
                            <td><input type="checkbox" value="日常检查" disabled/></td>
                            <td>隐藏隐私设备：</td>
                            <td><input type="checkbox" value="隐藏隐私设备" disabled/></td>
                        </tr>
                        <tr>
                            <td>预防维护：</td>
                            <td><input type="checkbox" value="预防维护" disabled/></td>
                            <td>非授权用户可报修：</td>
                            <td><input type="checkbox" value="非授权用户可报修" disabled/></td>
                        </tr>
                        <tr>
                            <td>计量：</td>
                            <td><input type="checkbox" value="计量" disabled/></td>
                            <td>质控批量操作：</td>
                            <td><input type="checkbox" value="质控批量操作" disabled/></td>
                        </tr>
                        <tr>
                            <td>工程师巡检：</td>
                            <td><input type="checkbox" value="工程师巡检" disabled/></td>
                            <td>大屏幕：</td>
                            <td><input type="checkbox" value="大屏幕" disabled/></td>
                        </tr>
                        <tr>
                            <td>预估实施日期：</td>
                            <td><input type="text" id="carry_out_time" disabled/></td>
                        </tr>
                    </tbody>
                    <tbody class="account-btn-body"  id="example-1">
                        <tr v-show="isShowEditBtn_1" style="display: none;">
                            <td colspan="4"><a class="btn" v-on:click="showEdit_1">编辑</a></td>
                        </tr>
                        <tr v-show="isEdit_1" style="display: none;">
                            <td colspan="2" ><a class="btn" v-on:click="cancelEdit_1">取消</a></td><td colspan="2"><a :class="isCommit?'btn commit-now-btn':'btn '" v-on:click="commitEdit_1">提交</a></td>
                        </tr>
                    </tbody>
                </table>
                <table class="accountTable">
                    <thead>
                    <tr>
                        <td align="right" style="font-size: 15px;font-family: 'Microsoft YaHei'">实施申请</td>
                    </tr>
                    </thead>
                    <tbody class="account-check-body" id="account-check-body-2">
                        <tr>
                            <td>医信精盘：</td>
                            <td><input type="checkbox" value="医信精盘" disabled/></td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td><span class="red-start">*</span>实施经理：</td>
                            <td>
                                <select id="managers" disabled>
                                    <option v-for="data in list" v-bind:value="data">{{data}}</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>备注：</td>
                            <td colspan="4"><input type="text" placeholder="实施经理在系统中的名称及电话" id="remark_manage" disabled/></td>
                        </tr>
                        <tr>
                            <td><span class="red-start">*</span>实施科室数：</td>
                            <td><input type="text" class="inputText" id="office_count" disabled/></td>
                        </tr>
                        <tr>
                            <td><span class="red-start">*</span>实施设备数：</td>
                            <td><input type="text" class="inputText" id="equipment_count" disabled/></td>
                        </tr>
                        <tr>
                            <td><span class="red-start">*</span>设备总数：</td>
                            <td><input type="text" class="inputText" id="equipment_total_count" disabled/></td>
                        </tr>
                        <tr>
                            <td>预估实施完成日期：</td>
                            <td><input type="text" id="complete_time" id="expectTime"/></td>
                        </tr>
                        <tr>
                            <td>后台完善：</td>
                            <td><input type="checkbox" value="后台完善" disabled/></td>
                        </tr>
                        <tr>
                            <td>实施报告：</td>
                            <td><input type="checkbox" value="实施报告" disabled/></td>
                        </tr>
                        <tr>
                            <td>备注：</td>
                            <td colspan="4"><input type="text" placeholder="后台默认完善spu基础字段，如果有特殊需求请再次备注" id="remark_complete" disabled/></td>
                        </tr>
                        <tr>
                            <td>上传科室建筑物目录：</td>
                            <td colspan="3">
                                <a v-show="isEdit_2" style="display: none;" href="javascript:;" class="a-upload" id="fileUpload"><input id="file_1" value="请选择" type="file"/>点击这里上传</a>
                                <p class="format">支持的格式有：'xlsm',XLSX','xls'</p>
                                <ul class="addAttachmentList" id="addAttachmentList">
                                </ul>
                            </td>
                        </tr>
                        <tr>
                            <td>上传医院台账资料：</td>
                            <td colspan="3">
                                <a v-show="isEdit_2" style="display: none;" href="javascript:;" class="a-upload" id="fileUpload_2"><input id="file_2" value="请选择" type="file"/>点击这里上传</a>
                                <p class="format">支持的格式有：'xlsm',XLSX','xls'</p>
                                <ul class="addAttachmentList" id="addAttachmentList_2">
                                </ul>
                            </td>
                        </tr>
                        <tr>
                            <td>上传医院质控资料：</td>
                            <td colspan="3">
                                <a  v-show="isEdit_2" style="display: none;" href="javascript:;" class="a-upload" id="fileUpload_3"><input id="file_3" value="请选择" type="file"/>点击这里上传</a>
                                <p class="format">支持的格式有：JPG，PNG，PDF，PPT，XLSX，XLS，CSV，DOCX，DOC，ZIP</p>
                                <ul class="addAttachmentList" id="addAttachmentList_3">
                                </ul>
                            </td>
                        </tr>
                        <tr>
                            <td>上传其他资料：</td>
                            <td colspan="3">
                                <a v-show="isEdit_2" style="display: none;" href="javascript:;" class="a-upload" id="fileUpload_4"><input id="file_4" value="请选择" type="file"/>点击这里上传</a>
                                <p class="format">支持的格式有：JPG，PNG，PDF，PPT，XLSX，XLS，CSV，DOCX，DOC，ZIP</p>
                                <ul class="addAttachmentList" id="addAttachmentList_4">
                                </ul>
                            </td>
                        </tr>
                    </tbody>
                    <tbody class="account-btn-body"  id="example-2">
                        <tr v-show="isShowEditBtn_2" style="display: none;">
                            <td colspan="4"><a class="btn" v-on:click="showEdit_2">编辑</a></td>
                        </tr>
                        <tr v-show="isEdit_2" style="display: none;">
                            <td colspan="2" ><a class="btn" v-on:click="cancelEdit_2">取消</a></td><td colspan="2"><a :class="isCommit?'btn commit-now-btn':'btn '" v-on:click="commitEdit_2">提交</a></td>
                        </tr>
                    </tbody>
                </table>

                <table class="accountTable">
                    <thead>
                    <tr>
                        <td align="right" style="font-size: 15px;font-family: 'Microsoft YaHei'">物料申请</td>
                    </tr>
                    </thead>
                    <tbody class="account-check-body" id="account-check-body-3">
                        <tr>
                            <td>二维码：</td>
                            <td><input type="checkbox" value="二维码" disabled/></td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>小米盒子：</td>
                            <td><input type="checkbox" value="小米盒子" disabled/></td>
                        </tr>
                        <tr>
                            <td>大屏电视：</td>
                            <td><input type="checkbox" value="大屏电视" disabled/></td>
                        </tr>
                    </tbody>
                    <tbody class="account-btn-body"  id="example-3">
                        <tr v-show="isShowEditBtn_3" style="display: none;">
                            <td colspan="4"><a class="btn" v-on:click="showEdit_3">编辑</a></td>
                        </tr>
                        <tr v-show="isEdit_3" style="display: none;">
                            <td colspan="2" ><a class="btn" v-on:click="cancelEdit_3">取消</a></td><td colspan="2"><a :class="isCommit?'btn commit-now-btn':'btn '" v-on:click="commitEdit_3">提交</a></td>
                        </tr>
                    </tbody>
                </table>



            </div>

            <!-- 客户信息卡 -->
            <div class="client-info-card rel" id="clientInfoCard" style="display: none;">
                <ul class="card-list clear" id="all-card-list">
                    
                </ul>
            </div>

            <!-- 项目需求列表 -->
            <div class="info-module pro-module rel" id="proNeedList" style="display: none;">
                <table class="pro-list">
                    <thead>
                        <tr>
                            <td>需求名称</td>
                            <td>需求方</td>
                            <td>紧急程度</td>
                            <td>提出人</td>
                            <td>提出时间</td>
                            <td>处理状态</td>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>

            <!-- 暂未完成 -->
            <div class="unfinished rel" id="unfinished" style="display: none;">
                <img src="../images/t-10.png">
                <p>攻城师正在努力开发中……</p>
            </div>
        </div>
        <div class="right content-right">
            <div class="buttons clear">
                <a class="left current record-tab" data-tab="commerce-data">商务进度</a>
                <a class="left record-tab" data-tab="business-data">运营进度</a>
            </div>
            <div class="business record-list commerce-data">
                <div class="add-cord add-progress-form" style="display: block">
                    <input type="button" value="添加记录" id="addcordbtn" />
                    <table class="add-input" id="addcordcontent" style="display: none;">
                        <tr>
                            <td width="20%">拜访方式</td>
                            <td><select id="visitTypeList"></select></td>
                        </tr>
                        <tr>
                            <td>拜访状态</td>
                            <td><select id="visitStatusList"></select></td>
                        </tr>
                        <tr>
                            <td>商务阶段</td>
                            <td><select id="bussTypeList"></select></td>
                        </tr>
                        <tr>
                            <td>拜访结果</td>
                            <td><select id="visitResultList"></select></td>
                        </tr>
                        <tr>
                            <td>紧急程度</td>
                            <td><select id="emergencyList"></select></td>
                        </tr>
                        <tr>
                            <td><span style="color: red;padding: 0 3px 0 0;">*</span>拜访人员</td>
                            <td>
                                <!--<ul class="visitors left" id="addPeopleList">-->
                                    <!--<li>小花</li>-->
                                    <!--<li>小黄</li>-->
                                <!--</ul>-->
                                <ul class="clear tag-list" id="addPeopleList">
                                    <!--<li>白骨精<input type="hidden" value="白骨精"><span>×</span></li>-->
                                </ul>
                                <div style="position: relative;float: left;">
                                <div class="add-tag" id="addPeopleBtn">+成员</div>
                                <div class="add-tag-exist-con" id="addPeopleSelect">
                                    <a href="javascript:" class="close" id="addPeopleClose">关闭</a>
                                    <ul class="tag-out-list" id="addPeopleUl">
                                        <!--<li>我是牛逼的小林<input type="hidden" value="我是牛逼的小林"><i></i></li>-->
                                    </ul>
                                </div>
                         </div>
                            </td>
                        </tr>
                        <tr>
                            <td>下次跟进</td>
                            <td><input type="" name="" id="nextFollow"></td>
                        </tr>
                        <tr>
                            <td>下次重点</td>
                            <td><input type="" name="" id="nextFocus"></td>
                        </tr>
                        <tr>
                            <td>需要支持</td>
                            <td><textarea id="support"></textarea></td>
                        </tr>
                        <tr>
                            <td><span style="color: red;padding: 0 3px 0 0;">*</span>本次拜访状况</td>
                            <td><textarea id="remark"></textarea></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <button id="surecord">添加</button><button id="canclecord">取消</button>
                            </td>
                        </tr>
                    </table> 
                </div>
                <div class="cord-list ">
                    <table class="cord-table" id="busCordTable">
                    </table>
                </div>
            </div>
            <div class="operatin record-list business-data" style="display: none">
                <div class="add-operatin add-progress-form">
                    <input type="button" value="添加记录" id="addBusinessbtn"  style="display: none"/>
                    <table class="add-input" id="businessTable" style="display: none;">
                        <tr>
                            <td width="21%"><span style="color: red;padding: 0 3px 0 0;">*</span>运营阶段</td>
                            <td><select id="businessStage">
                                <option value="已开户">已开户</option>
                                <option value="待实施">待实施</option>
                                <option value="待培训">待培训</option>
                                <option value="已培训">已培训</option>
                                <option value="交付报告">交付报告</option>
                            </select></td>
                        </tr>
                        <tr>
                            <td><span style="color: red;padding: 0 3px 0 0;">*</span>开始日期</td>
                            <td><input type="" name="" id="startDate"></td>
                        </tr>
                        <tr>
                            <td><span style="color: red;padding: 0 3px 0 0;">*</span>相关负责人</td>
                            <td>
                                <!--<ul class="visitors left" id="addPeopleList">-->
                                <!--<li>小花</li>-->
                                <!--<li>小黄</li>-->
                                <!--</ul>-->
                                <ul class="clear tag-list" id="addChargePeopleList">
                                    <!--<li>白骨精<input type="hidden" value="白骨精"><span>×</span></li>-->
                                </ul>
                                <div style="position: relative;float: left;">
                                    <div class="add-tag" id="addChargePeopleBtn">+成员</div>
                                    <div class="add-tag-exist-con" id="addChargePeopleSelect">
                                        <a href="javascript:" class="close" id="addChargePeopleClose">关闭</a>
                                        <ul class="tag-out-list" id="addChargePeopleUl">
                                            <!--<li>我是牛逼的小林<input type="hidden" value="我是牛逼的小林"><i></i></li>-->
                                        </ul>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>合同进度</td>
                            <td><select id="bargainProgress">
                                <option value="未签约">未签约</option>
                                <option value="试用签约">试用签约</option>
                                <option value="正式签约">正式签约</option>
                            </select></td>
                        </tr>
                        <tr>
                            <td>合同时长</td>
                            <td>
                                <input type="" name="" id="bargainTime">
                            </td>
                        </tr>
                        <tr>
                            <td>备注</td>
                            <td><textarea id="buinessRemark"></textarea></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <button id="businessAdd">添加</button><button id="businessCancle">取消</button>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="cord-list">
                    <table class="cord-table" id="operatinTable">
                    </table>
                </div>
            </div>
        </div>
    </div>

</div>

<!-- 项目成员 -->
<div class="item-member" style="display: none;">
    <h3>项目负责人</h3>
    <div >
        <ul id="owner-line">

        </ul>
    </div>
    <h3>
        项目成员
        <a class="add-member add" href="javascript:;" onclick="addMemberShow(this);" id="addMemberShowId">+&nbsp;添加</a>
        <div class="member-slide" style="display:none">
            <div class="search-member">
                <input type="" name="" id="searchUser" onkeyup="addMemberShow()"/>
            </div>
            <div class="member-box">
                <ul class="mem-list" id="mem-list">
                    <li class="clear">
                        <div class="left"></div>
                        <span class="left">张三</span>
                        <i class="right"></i>
                    </li>

                </ul>
            </div>
            <div class="btns"><a class="sure" onclick="sureAddMeber(this)">确认</a><a class="cancel" onclick="addMemberHide()">取消</a></div>
        </div>
    </h3>
    <ul id="list-line" class="show-exit-list">

    </ul>
</div>
<div class="user-mask"></div>

<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.cookie.js"></script>
<script src="../js/common.js"></script>
<script src="../js/user-tree.js"></script>

<script src="../js/foundation-datepicker.min.js"></script>
<script src="../js/proDetail.js"></script>
<script src="../js/proDetail_account.js"></script>
<script type="text/javascript">
_API.getSellType('sellTypeSelect')
    .getPBussTypeList('bussTypeList',false,false,globleProjectId)
    .getVisitTypeList('visitTypeList')
    .getVisitStatusList('visitStatusList',false,false,globleProjectId)
    .getVisitResultList('visitResultList')
    .getEmergencyList('emergencyList');


var globleproname = $$.getUrlParaObj()['name'];
$('#getHeadProName').html(globleproname);
function getHeadProName() {
    location.href = 'mems-pro-baseInfo.html?id='+getUrlId()+'&name='+globleproname;
}


var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
$('#startDate').fdatepicker({
  format: 'yyyy-mm-dd',
  onRender: function (date) {
    return date.valueOf() < now.valueOf() ? 'disabled' : '';
  }
});
$('#nextFocus').fdatepicker({
  format: 'yyyy-mm-dd',
  onRender: function (date) {
    return date.valueOf() < now.valueOf() ? 'disabled' : '';
  }
});
$('#carry_out_time').fdatepicker({
    format: 'yyyy-mm-dd',
    onRender: function (date) {
        return date.valueOf() < now.valueOf() ? 'disabled' : '';
    }
});
$('#complete_time').fdatepicker({
    format: 'yyyy-mm-dd',
    onRender: function (date) {
        return date.valueOf() < now.valueOf() ? 'disabled' : '';
    }
});


    var itemId = globleProjectId;
    // 时间控件
    $('#proTime').fdatepicker({
        format: 'yyyy-mm',
//        pickTime: false
    });

    $('#getMoneyTime').fdatepicker({
        format: 'yyyy-mm',
//        pickTime: false
    });



    // addCard();
    function addCard(){
        var html = '';
        html += '<div class="client-card-box">';
            html += '<p class="card-title">添加客户<a href="javascript:$$.closeLayer()">&times;</a></p>';
            html += '<div class="card-box">';
                html += '<table class="card-input"><tbody>';
                    html += '<tr><td>职务</td><td><input type="" name="" class="short"></td></tr>';
                    html += '<tr><td>角色</td><td><input type="" name="" class="short"></td></tr>';
                    html += '<tr><td>姓名</td><td><input type="" name="" class="short"></td></tr>';
                    html += '<tr><td>科室</td><td><input type="" name="" class="short"></td></tr>';
                    html += '<tr><td>联系电话</td><td><input type="" name="" class="short"></td></tr>';
                    html += '<tr><td>短号</td><td><input type="" name="" class="short"></td></tr></table></tbody></div>';
            html += '<div class="buttons"><a class="card-btn card-btn-gray" href="javascript:$$.closeLayer()">取消</a>&emsp;<a id="confirmRelative" class="card-btn">确认</a></div>'
        html += '</div>';
        $$.layer(html, {
            isShowMask: true,
            fixedBoxTop:'100px',
            zIndex:99,
            contentBoxWidth: "27%"
        });

        
    }

    function addUserShow() {
        var $itemMember = $('.item-member').css('display', 'block');
        $('.user-mask').css('display', 'block');
        $itemMember.animate({
            right: '0px',
            opacity: 1
        }, 500);
        getPuser();
    }

    function addMemberShow(obj,isTrans) {
        var $obj = $(obj);
        var url  = _ip+'/user/plist'; //添加成员
        if(isTrans){
            url = _ip + '/user/assign'  //转让列表
        }
        var name = $('#searchUser').val();
        var data = {
            pid: itemId,
            name: name
        };
        var $memList = $('#mem-list').html('');
        $('.error-msg').remove();
        if ($obj) {
            if ($obj.hasClass('add')) {
                $('.member-slide').addClass('addClass').removeClass('assignmentClass');
            }
            else if ($obj.hasClass('assignment')) {
                $('.member-slide').addClass('assignmentClass').removeClass('addClass');
            }
        }
        $('.member-slide').show();
        if ($('.member-slide').hasClass('assignmentClass')) {
            $('.search-member').css('display', 'none');
            data = {

            };
            organizeAjaxPost(url, data, function(json) {
                if (json.success) {
                    var allUserData = json.data;
                    for (var key in allUserData) {
                        allUserData[key].single = 'single';
                        puserList(allUserData[key], $memList, 'allUser');
                    }
                }
            });
        }
        else {
            $('.search-member').css('display', 'block');

            organizeAjaxPost(url, data, function(json) {
                if (json.success) {
                    var allUserData = json.data;
                    for (var key in allUserData) {
                        puserList(allUserData[key], $memList, 'allUser');
                    }
                }
            });
        }
    }

    function addMemberHide() {
        $('#mem-list').html('');
        $('.member-slide').hide();
        $('#searchUser').val('')
    }

    function sureAddMeber(obj) {
        var $obj = $(obj);
        var url  = _ip+'/puser/insert';
        var uid_arr = [];
        var $memberSlide = $obj.closest('.member-slide');
        var $memList = $memberSlide.find('#mem-list');
        var $activeCheck = $memList.find('.check.active');
        var data = {
            pid: itemId,
            uid:''
        };
        var uid_arr_str;
        $('.error-msg').remove();
        $activeCheck.each(function(index, dom) {
            var $dom = $(dom);
            var id= $dom.closest('li').attr('id');
            uid_arr.push(id);
        });
        if(!uid_arr.length) {
            $('.member-box').prepend('<p class="error-msg">请选择成员</p>');
            return false;
        }
        uid_arr_str = uid_arr.join();
        data.uid = uid_arr_str;
//        console.log(data);
        if($('.member-slide').hasClass('assignmentClass')) {
            var ownerId = parseInt(uid_arr_str);
            url  = _ip+'/project/update';
            data = {
                id: itemId,
                ownerId: ownerId
            };
            organizeAjaxPost(url, data, function(json) {
                if (json.success) {
                    var $deleteIcon = $('#list-line').find('#'+ownerId).find('.deletePuserClick');
                    addMemberHide();
                    getPuser();
                }
            });
        }
        else {
            organizeAjaxPost(url, data, function(json) {
                if (json.success) {
                    addMemberHide();
                    getPuser();
                }
            });
        }
    }

    function deletePuserClick(obj) {
        var url  = _ip+'/puser/select';
        var data = {
            id: getUrlId()
        };
        var arr = [];
        var isShowMark = false;
        organizeAjaxGet(url, data, 'dd', function(json) {
            if (json.success) {
                arr.push(json.data.owner.id);
                for(var k = 0; k < json.data.list.length; k++){
                    arr.push(json.data.list[k].id);
                }
                var isProMember = false;
                for(var n = 0; n < arr.length; n++){
                    if(globleUserId == arr[n]){
                        isProMember = true;
                        break;
                    }
                }
                if(globleRoleId == 9 || globleRoleId == 3 || ( globleRoleId == 1 && isProMember )){
                    isShowMark = true;
                }

                if(isShowMark){

                    var $obj = $(obj);
                    var id = $obj.closest('li').attr('id');
                    var url  = _ip+'/puser/delete';
                    var data = {
                        pid: itemId,
                        uid: id
                    };
//        console.log(11);
                    organizeAjaxGet(url, data, 'delete_puser', function(json) {
                        if (json.success) {
                            getPuser();
                        }
                    });

                }else{
                    alert('您无权限操作！');
                }
            }

        })



    }

    function puserList(owner_data, $content, leader) {
        var getRandomNum = 1;
        var owner_photo = $('' +
                '<div class="photo left">' +
                '<i class="img"><img src="../images/portrait'+ getRandomNum  +'.png"></i>' +
//                '<div class="info-slide">' +
//                '<table class="slide-table">' +
//                '<tr><td class="td-img">' +
//                '<div class="img"><img src="../images/portrait'+ getRandomNum  +'.png"></div>' +
//                '<h3>'+ owner_data.name +'</h3>' +
//                '<h6>'+ owner_data.ocpName +'</h6>' +
//                '</td></tr>' +
//                '<tr><td><p><i class="tel"></i>'+ owner_data.phone +'</p></td></tr>' +
//                '<tr><td><p><i class="email"></i>'+ owner_data.email +'</p></td></tr>' +
//                '<tr> <td> <p><i class="dec"></i>'+owner_data.dptName+'</p></td></tr>' +
//                '</table>' +
//                '</div>' +
                '</div>');
//        console.log(owner_data);
        var owner_info = $('<div class="info left"><p>'+ owner_data.name +'</p><p class="removeOcp">'+ owner_data.ocpName +'</p></div>');

        if(globleRoleId == 9 || globleRoleId == 3 || globleRoleId == 1){
            var owner_opero = $('<div class="opero right"><a href="javascript:;" class="assignment" id="transferMember" onclick="addMemberShow(this,true);">转让</a></div>');
        }else{
            var owner_opero = $('<div class="opero right"></div>');
        }
        var $div = $('<div class="member clear"></div>');
        var $li = $('<li id="'+ owner_data.id +'"></li>');
        if (leader === 'leader') {
            $div.addClass('leader');

        }
        else if (leader === 'allUser') {
            var single = '';
            if(owner_data.single) {
                single = 'single';
            }
            $li = $('<li class="'+ single +'" onclick="activeCheck(this)" id="'+ owner_data.id +'"></li>');
//            owner_info.find('.removeOcp').remove();

            owner_opero = $('<div class="opero right"><a class="check" href="javascript:;" ></a></div>');
        }
        else {
            var owner_info = $('<div class="info left"><p>'+ owner_data.name+ '&nbsp;&nbsp;<span>'+ owner_data.phone +'</span></p><p class="removeOcp">'+ owner_data.dptName+ '-'+ owner_data.ocpName +'</p></div>');
            owner_opero = $('<div class="opero right"><a class="deletePuserClick" href="javascript:;" onclick="deletePuserClick(this)">×</a></div>');

        }
        $div.append(owner_photo).append(owner_info).append(owner_opero);
        $li.append($div);
        $content.append($li);
    }

    function activeCheck(obj) {
        var $obj = $(obj);
        if ($obj.hasClass('single')) {
            $obj.find('.check').addClass('active').closest('li').siblings().find('.check').removeClass('active');
        }
        else {
            $obj.find('.check').addClass('active');
        }
    }

    function getPuser() {
        var url  = _ip+'/puser/select';
        var data = {
            id: itemId
        };
        $('.error-msg').remove();
        organizeAjaxGet(url, data, 'get_puser', function(json) {
            if (json.success) {
                var $ownerLine = $('#owner-line').html('');
                var $listLine = $('#list-line').html('');
                var owner_data = json.data.owner;
                var list = json.data.list;
                puserList(owner_data, $ownerLine, 'leader');
                for (var key in list) {
                    puserList(list[key], $listLine);
                }
            }
        });
    };

    $('.user-mask').on('click', function() {
        var $itemMember = $('.item-member');
        $('.user-mask').css('display', 'none');
        $itemMember.animate({
            right: '-298px',
            opacity: 0
        }, 500);
    });



function forbidenOpe() {}
forbidenOpe.prototype = {

    init:function(){
        this.mark = false;
        this.userId = $.cookie('userid');
        var that = this;
        this.ismember(that.do)
    },
    ismember:function(callback) {
        var that = this;
        var url  = _ip+'/puser/select';
        var data = {
            id: getUrlId()
        };
        var arr = [];
        organizeAjaxGet(url, data, 'dd', function(json) {
            if (json.success) {
                arr.push(json.data.owner.id);
                for(var k = 0; k < json.data.list.length; k++){
                    arr.push(json.data.list[k].id);
                }
                var isProMember = false;
                for(var n = 0; n < arr.length; n++){
                    if(that.userId == arr[n]){
                        isProMember = true;
                        break;
                    }
                }
                if(globleRoleId == 9 || globleRoleId == 3){
                    that.mark = true;
                }
                if( (globleRoleId == 0 || globleRoleId == 1 || globleRoleId == 2) && isProMember ){
                    that.mark = true;
                }
                if(!that.mark){
                    if(callback) callback();
                }
            }

        })
    },
    do:function () {
//        console.log(222222)
        $('#addMemberShowId').remove();
        $('#addtag-1').remove();
        $('#addtag-2').remove();
        $('#addtag-3').remove();
        $('#tag-dec-1').prop({'disabled':true});
        $('#tag-dec-2').prop({'disabled':true});
        $('#tag-dec-3').prop({'disabled':true});
        $('#tag-dec-4').prop({'disabled':true});
        $('#addcordbtn').remove();
        $('#addBusinessbtn').remove();
        $('#editeSaleType').remove();
    }
}
forbidenOpe =  new forbidenOpe()
forbidenOpe.init();
</script>
</body>
</html>